package net.ib.mtalk.ui.buddy.contact;

import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Handler;
import android.util.Log;
import net.ib.mntalk.protocol.Common.ContactAccountInfo;
import net.ib.mntalk.protocol.Common.ContactInfo;
import net.ib.mntalk.protocol.Common.Name;
import net.ib.mntalk.protocol.Session;
import net.ib.mntalk.protocol.Session.AddContactsReq;
import net.ib.mntalk.protocol.Session.GetContactsReq;
import net.ib.mntalk.protocol.Session.SendMessageReq;
import net.ib.mntalk.protocol.Session.SendMessageRes;
import net.ib.mtalk.constant.HandlerMsgConst;
import net.ib.mtalk.database.DatabaseContract.BuddyTable;
import net.ib.mtalk.network.MethodId;
import net.ib.mtalk.network.NetResultReceiver;
import net.ib.mtalk.network.TcpClient;
import net.ib.mtalk.network.TcpEnvelope;
import net.ib.mtalk.network.NetResultReceiver.Receiver;
import net.ib.mtalk.network.task.AddContactsTask;
import net.ib.mtalk.ui.UIController;
import net.ib.mtalk.ui.chat.ChatListActivity;
import net.ib.mtalk.util.NotifyingAsyncQueryHandler;
import net.ib.mntalk.protocol.Common.UUIDMsg;

public class BuddyContactController extends UIController {

	private NetResultReceiver mReceiver;
	
	private Handler mUiHandler = new Handler();
	
	public BuddyContactController(Context context, Handler handler) {
		super(context, handler);
		mUiHandler = handler;
	}

	public void addContacts(AddContactsReq contacts){
		
/*		AddContactsTask task = new AddContactsTask(mContext, mUiHandler, _accountValue, _type, _firstName, _lastName, _middlename, 
				_namePrefix, _nameSuffix, _phoneticFamilyName, _phoneticGivenNmae, _phoneticMiddleName, _index);*/
/*		AddContactsReq addContactsReq = new AddContactsReq();
		addContactsReq.setUserUuid(new UUIDMsg().setLsb(111).setMsb(222));
		ContactInfo contactInfo = new ContactInfo();
		ContactAccountInfo accountInfo = new ContactAccountInfo();
		accountInfo.setAccountValue("value");
		accountInfo.setType(0);
		Name name = new Name();
		name.setDisplayName("Display");
		name.setFirstName("First");
		name.setLastName("Last");
		name.setMiddleName("Middle");
		name.setNamePrefix("Pre");
		name.setNameSuffix("Suffix");
		name.setPhoneticFamilyName("Family");
		name.setPhoneticGivenName("Given");
		name.setPhoneticMiddleName("Middle");
		contactInfo.setAccount(accountInfo);
		contactInfo.setName(name);
		
		try {
			TcpEnvelope rev = new TcpEnvelope.Builder()
				.setType(TcpEnvelope.REQUEST)
				.setMessage(addContactsReq)
				.setMethodId(MethodId.Contact.AddContacts)
				.setCallback(mReceiver)
				.build();
			TcpClient.send(rev);
		} catch (Exception e) {
			// TODO: handle exception
		}*/
		
//		BuddyDatabaseHelper.insertBuddy(mQueryHandler);
	}
}
